# -*- coding: utf-8 -*-
import os
from dotenv import load_dotenv


import pymysql
def get_db():
    load_dotenv(dotenv_path="./mysql.env")
    host = os.getenv("MYSQL_HOST")
    user = os.getenv("MYSQL_USER")
    pwd = os.getenv("MYSQL_PWD")
    # port = os.getenv("MYSQL_PORT")
    db = os.getenv("MYSQL_DB")
    return pymysql.connect(host=host, port=3306, user=user, passwd=pwd, db=db)


if __name__ == "__main__":
    db = get_db()
    cursor = db.cursor()
    result = cursor.execute("SELECT 1")
    print(result)
